<?php namespace App\Http\Controllers;


use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Http\Controllers\SiteController;
use Illuminate\Http\Request;
use App\NewsCategory;
use App\News;
use Illuminate\Support\Facades\View;

class NewsCategoryController extends SiteController {

    public function category($categoryName, NewsCategory $NewsCategory){
        $categorys = $NewsCategory->getAllNewsCategorys()->toArray();
        $categorysTemp = array();
        array_walk($categorys,function($value,$key)use(&$categorys,&$categorysTemp){
            $categorysTemp[strtolower($value['title'])] = $value;
        });
        $category = (Object) $categorysTemp[$categoryName];
        $news = $NewsCategory->NewsWhereCategory($category->id);
        return view('site.newsCategory.news_category')->with('news', $news);
    }

	/**
	 * Display a listing of the resource.
	 *
	 * @return Response
	 */
	public function index()
	{
		//
	}

	/**
	 * Show the form for creating a new resource.
	 *
	 * @return Response
	 */
	public function create()
	{
		//
	}

	/**
	 * Store a newly created resource in storage.
	 *
	 * @return Response
	 */
	public function store()
	{
		//
	}

	/**
	 * Display the specified resource.
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function show($id)
	{
		//
	}

	/**
	 * Show the form for editing the specified resource.
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function edit($id)
	{
		//
	}

	/**
	 * Update the specified resource in storage.
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function update($id)
	{
		//
	}

	/**
	 * Remove the specified resource from storage.
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function destroy($id)
	{
		//
	}

}
